package anni.atracker.domain;

import java.io.Serializable;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;


/**
 * TrackerProject generated by Lingo.
 *
 * @author Lingo
 * @since 2007年10月07日 下午 18时23分51秒593
 */
@Entity
@Table(name = "A_TRACKER_PROJECT")
public class TrackerProject implements Serializable {
    /** * serial. */
    static final long serialVersionUID = 0L;

    /** * id. */
    private Long id;

    /** * name. */
    private String name;

    /** * theSort. */
    private Integer theSort;

    /** * summary. */
    private String summary;

    /** * founder. */
    private String founder;

    /** * trackerIssues. */
    private Set<TrackerIssue> trackerIssues = new HashSet<TrackerIssue>(0);

    /** * 构造方法. */
    public TrackerProject() {
    }

    /** * @return id. */
    @GenericGenerator(name = "generator", strategy = "increment")
    @Id
    @GeneratedValue(generator = "generator")
    @Column(name = "ID", unique = true, nullable = false)
    public Long getId() {
        return id;
    }

    /** * @param id Long. */
    public void setId(Long id) {
        this.id = id;
    }

    /** * @return name. */
    @Column(name = "NAME", length = 100)
    public String getName() {
        return name;
    }

    /** * @param name String. */
    public void setName(String name) {
        this.name = name;
    }

    /** * @return theSort. */
    @Column(name = "THE_SORT")
    public Integer getTheSort() {
        return theSort;
    }

    /** * @param theSort Integer. */
    public void setTheSort(Integer theSort) {
        this.theSort = theSort;
    }

    /** * @return founder. */
    @Column(name = "FOUNDER", length = 50)
    public String getFounder() {
        return founder;
    }

    /** * @param founder String. */
    public void setFounder(String founder) {
        this.founder = founder;
    }

    /** * @return summary. */
    @Column(name = "SUMMARY", length = 6000)
    @Lob
    public String getSummary() {
        return summary;
    }

    /** * @param summary String. */
    public void setSummary(String summary) {
        this.summary = summary;
    }

    /** * @return trackerIssues. */
    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "trackerProject")
    public Set<TrackerIssue> getTrackerIssues() {
        return trackerIssues;
    }

    /** * @param trackerIssues Set. */
    public void setTrackerIssues(Set<TrackerIssue> trackerIssues) {
        this.trackerIssues = trackerIssues;
    }

    /**
     * 让树节点显示text.
     *
     * @return text.
     */
    @Transient
    public String getText() {
        return name;
    }

    /** * @return leaf. */
    @Transient
    public boolean isLeaf() {
        return true;
    }

    /** * @return allowDelete. */
    @Transient
    public boolean isAllowDelete() {
        return true;
    }

    /** * @return allowEdit. */
    @Transient
    public boolean isAllowEdit() {
        return true;
    }
}
